print("202509221529")
local function listDescendants(root, prefix)
    prefix = prefix or root.Name
    for _, v in ipairs(root:GetChildren()) do
        local path = prefix .. "." .. v.Name
        print(path, v.ClassName)
        listDescendants(v, path)
    end
end

local RS = game:GetService("ReplicatedStorage")
if RS:FindFirstChild("Trade") then
    print("=== ReplicatedStorage.Trade 枚举开始 ===")
    listDescendants(RS.Trade, "ReplicatedStorage.Trade")
    print("=== ReplicatedStorage.Trade 枚举结束 ===")
else
    warn("ReplicatedStorage 下未找到 Trade")
end


-- 等待 LocalPlayer 与 PlayerGui 就绪
local Players = game:GetService("Players")
local lp = Players.LocalPlayer
if not lp then
    repeat task.wait(0.4); lp = Players.LocalPlayer until lp
end
local pg = lp:FindFirstChild("PlayerGui") or lp:WaitForChild("PlayerGui", 10)
local function contains(s, sub) return typeof(s)=="string" and string.find(string.lower(s), string.lower(sub), 1, true) end

local candidates = {}
if pg then
    print("PlayerGui 就绪：", pg:GetFullName())
    for _, gui in ipairs(pg:GetDescendants()) do
        if gui:IsA("TextButton") or gui:IsA("ImageButton") then
            local nameStr = gui.Name or ""
            local textStr = ""
            if gui:IsA("TextButton") then
                -- 仅 TextButton 才安全读取 Text 属性
                textStr = gui.Text or ""
            end
            local mark = (contains(nameStr, "trade") or contains(textStr, "trade"))
                and (contains(nameStr, "request") or contains(textStr, "request"))
            if mark then
                table.insert(candidates, gui)
                print("可能的开关按钮：", gui:GetFullName(), gui.ClassName, textStr)
            end
        end
    end
else
    warn("PlayerGui 未就绪，无法扫描 UI")
end

-- 想尝试自动点 OFF 就取消下一段注释
if #candidates == 0 then
    warn("未找到可能的 Trade Requests 开关按钮")
else
    for _, btn in ipairs(candidates) do
        print("尝试切 OFF：", btn:GetFullName())
        pcall(function() btn:Activate() end)
        task.wait(0.2)
    end
end